<?php

//连接到数据库
require 'connect.php';

//获取信息
$e_name=$_POST['e_name'];

$e_dept=$_POST['bumen'];

$e_img=$_POST['e_img'];
$date_of_birth=$_POST['date_of_birth'];
$date_of_entry=$_POST['date_of_entry'];

//echo $e_dept;
//echo $e_name;
//echo $e_img;
// 将信息传递到数据库  执行
$sql="insert into tb_emp (e_name,e_dept,e_img,date_of_birth,date_of_entry) values('$e_name','$e_dept','$e_img','$date_of_birth','$date_of_entry')";
$result=$dd->query($sql); //执行sql语句 将结果赋给$result

//判断是否添加成功 
if($result)
{
    echo "<script language='javascript'type='text/javascript'>";
    echo   " alert('添加成功');";
    echo   " window.location.href='index.php';";
    echo    "</script>";
}
else
{
    echo "<script language='javascript'type='text/javascript'>";
    echo   " alert('添加失败');";
    echo   " window.location.href='index.php';";
    echo    "</script>";
}